$(function() {

    var url = WWW_URL + '/qcwdProduct/getProductByIds?ids=';


    $.ajax({
        url: url + href.join(","),

        dataType: "jsonp",
        jsonp: "jsonpcallback",
        success: function(data) {
            if (data.error == false) {

                var productData = data.msg;
                var dataLength = productData.length;

                for (var i = 0; i < dataLength; i++) {
                    var productName = productData[i]['name'];
                    var id = productData[i]['id']
                    var price = productData[i]['price'];
                    var discountPrice = productData[i]['discountPrice'];
                    var pic = productData[i]['pic'];
                    var isfree = productData[i]['isfree'];
                    var isdouble = productData[i]['isdouble'];
                    var isavctive_full = productData[i]['isavctive_full'];
                    var discount = productData[i]['discount'];
                    var stock_num = productData[i]['stock_num'];
                    var price_on_tag = productData[i]['price_on_tag'];
                    var status = productData[i]['status'];
                    var discountStartTime=productData[i]['discountStartTime'];
                        var discountEndTime=productData[i]['discountEndTime'];
                        var d = new Date();
                        var n = Math.round(d.getTime()/1000);
                        if(discountStartTime!=0 && discountEndTime!=0){
                            if(discountStartTime<n && n<discountEndTime){
                               
                                price = discountPrice;
                            }
                            else{
                                price = price;
                            }
                        }
                        else{
                             price=price;
                        }
                    var showfreeClass = '';
                    if (isfree == '') {
                        showfreeClass = 'displayNone';
                    }
                    var errorimage = "public.cjwsc.com/images/product_loading.gif";

                    $('[data-id="' + id + '"]').find(".price .discountPrice").text(price);
                    $('[data-id="' + id + '"]').find(".price .price_on_tag").text("￥"+price_on_tag);
                    // $('[data-id="' + id + '"]').find(".price>div").addClass(showfreeClass);


                    if (stock_num < 1 || status != 1) {
                        // $('[data-id="' + id + '"]').addClass("col_sx").removeClass("C_J_good");
                    }


                }
            } else {
                console.log('error');
            }
        }
    });
})